//二次封装axios
import axios from "axios"

const request = axios.create({
    baseURL: '/api',
    timeout: 2 * 1000
})

request.interceptors.request.use(config => {
    return config
})
request.interceptors.response.use((response)=>{
    if(response.data.code === 200){
        return response.data
    }else{
        return Promise.reject('请求失败')
    }
},(error)=>{
    return Promise.reject(error.message)
})

export default request